/**
 * Copyright 2015 51h5.com All rights reserved.
 */
!function (e, t) {
    function n(e) {
        var t = Yt[e], n = Array.prototype.slice.call(arguments, 1);
        if (t) {
            t = t.slice(0);
            for (var o = 0, r = t.length; r > o; o++)t[o].apply(Ot, n)
        }
    }

    function o() {
        if (!Nt && !Ht) {
            Ht = !0, Ut.submitScore = !0, Ut.gameId = N("gameid"), Ut.appBanner = !(dt[pt] && dt[pt][3] || "no" === N("appbanner") || Ot.is("app"));
            var t = j("aid");
            if (Ut.zhan && t && (Ut.ad.loading = t), Ot.is("hoowu")) {
                var n = "_hwInitInApp";
                e[n] = function (t) {
                    e[n] = null, t && t.uuid && r(t)
                }, Ot.appCall("userinfo", n)
            } else r();
            Ut.noLogo = dt[pt] && dt[pt][4], Ut.channelLogo = dt[pt] && dt[pt][0], Ut.channelAloneLogo = Ut.channelLogo && dt[pt][1];
            var o = N("splashscreen");
            return o && (Qt = parseInt(o, 10) || 0), Qt && Ot.splashscreen(Qt + (Ut.channelAloneLogo ? Ft : 0) + (Ut.ad.loading ? Vt : 0)), (Ut.banner || Object.keys(Ut.ad).length) && w(), "function" == typeof onHoowuReady && e.onHoowuReady(), Ot
        }
    }

    function r(e) {
        Ht && Ot.get("init", function () {
            Ht = !1, zt = e ? e.uuid : localStorage.getItem(Xt + "guid");
            var t = N("key");
            return t && (Lt = t, $t = Lt + "_"), Lt ? void Ot.get("bt", function (e) {
                return e ? (jt = e.token, zt = zt || e.guid, localStorage.setItem(Xt + "guid", zt), void Ot.get("vt", function (e) {
                    return e ? (Rt = e, Nt = !0, a(), Dt.forEach(function (e) {
                        s.apply(null, e)
                    }), void(Dt = null)) : void n("error", {type: "init", code: 102})
                })) : void n("error", {type: "init", code: 101})
            }) : void n("error", {type: "init", code: 100})
        })
    }

    function i() {
        var e = Ot.env;
        e.hoowu || e.game || 1 & Ut.options || "no" === (N("toolbar") || "").toLowerCase() || dt[pt] && dt[pt][2] || Ot.getScript(Et + "/open/sdk.php?t=tb")
    }




    function s(e, t, n, o) {
        var r = Pt[t];
        if (r && !(0 === r & Bt[e])) {
            if (!Nt && "init" !== t && "bt" !== t && "vt" !== t)return void Dt.push(Array.prototype.slice.call(arguments));
            E(n) && (o = n, n = null);
            var i = qt[t];
            if (i) {
                try {
                    i.abort()
                } catch (a) {
                }
                i = null, delete qt[t]
            }
            qt[t] = b(nt, u(t, e), n, o)
        }
    }

    function u(e, t) {
        return _t + It + (t === tt ? "get" : "set") + e + ".html"
    }



    function p(e) {
        var t = null, o = h(), r = "none" !== o.style.display;
        if ("boolean" === k(e) ? e !== r && (t = e ? 1 : 0) : t = r ? 0 : 1, null !== t) {
            o.style.display = t ? "block" : "none", n("splashscreen." + (t ? "show" : "hide"));
            var i = A(".inner", o);
            i[0].style.display = t ? "block" : "none", Ut.channelAloneLogo && t && i.length > 1 && (clearTimeout(nn), nn = setTimeout(function () {
                i[1].style.display = "block", i[0].parentNode.removeChild(i[0]), i = null
            }, Ft))
        }
    }

    function h() {
        var e = M(on);
        if (!e) {
            var t = N("author");
            t && (t = t.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
            var n = Ut.ad.loading, o = Ot.dprScale, r = 18 * Ot.fontScale, i = [on + " {zoom:" + o + ";font-size:" + r + "px;position:fixed;left:0;top:0;z-index:9947483646;width:100%;height:100%;box-sizing:border-box;color:#fff;text-shadow:none;font-family:'Microsoft Yahei', Arial, 'Helvetica Neue', sans-serif;-webkit-font-smoothing: antialiased;}", on + " .inner {display:none;position:relative;top:0;width:100%;height:100%;padding-top:80px;pointer-events:none;background: #fff;}", on + " .inner[data-ui~=ad] {padding-top: 2px;}", on + " .inner[data-ui~=day] {background: #167de6;}", on + " .inner[data-ui~=night] {background: #2c2a2a;}", on + " .inner[data-ui~=alone] {padding-top: 2px;}", on + " .inner[data-ui~=alone] img {width: auto;height: auto;position: absolute;top: 40%;left: 50%;margin:-100px auto auto -130px;}", on + " .ft {position: absolute; bottom: 0; width: 100%; height: 290px;}", on + " .ft *{position: static;}", on + " img {display:block;margin:10px auto 30px;height:80px;width:auto;}", on + " p {font-size:" + r + "px;line-height:24px;text-align:center;margin:10px auto;padding:0 10px;}", on + " .hw_info {font-size: " + .8 * r + "px;color: rgba(255,255,255,.7);}", on + " .progress {height:20px;overflow:hidden;margin: 5px 10px;background-color:#f5f5f5;border-radius:4px;box-sizing:border-box;box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);}", on + " .progress .bar {float:left;min-width:20px;height:100%;line-height:20px;font-size:" + .7 * r + "px;text-align:center;color:#fff;box-sizing:border-box;background-color:#428bca;box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);transition:width .6s ease;-webkit-transition:width .6s ease;-o-transition:width .6s ease;}"];
            x(i.join("")), e = et.createElement("div"), e.id = on.slice(1), e.style.display = "none";
            var a = (new Date).getHours();
            a = 6 > a || a > 20 ? "night" : "day", e.innerHTML = Ut.channelLogo && Ut.channelAloneLogo ? ['<div class="inner" data-ui="alone">', '<img src="' + St + "/images/home/loading_" + dt[pt][0] + '.png">', "</div>", '<div class="inner" data-ui="alone ' + a + '">', '<img src="' + St + '/images/home/loading_hoowu.png" >', "</div>", n ? '<div class="ft" id="hw_ad_' + n + '"></div>' : ""].join("") : ['<div class="inner" data-ui="' + (n ? "ad" : "") + " " + a + '">', Ut.noLogo ? "" : '<img src="' + St + '/images/home/logo_wr_220x100_black.png" height="80">', Ut.channelLogo && !Ut.channelAloneLogo ? '<img src="' + St + "/images/home/logo_" + dt[pt][0] + '.png" height="80">' : "", Ut.noLogo ? "" : t ? "<p><strong>\u706b\u821e\u6e38\u620f</strong> &bull; <strong>" + t + "</strong> \u539f\u521b\u51fa\u54c1</p><p>\u8f6c\u8f7d\u8bf7\u7ecf\u8fc7\u6388\u6743\uff0c\u4fb5\u6743\u5fc5\u7a76</p>" : "<p>\u706b\u821e\u6e38\u620f &bull; \u4e3a\u672a\u6765\u800c\u751f</p>", Ut.noLogo ? '<p style="margin-top: 40%;">\u6b63\u5728\u542f\u52a8\u6e38\u620f ...</p>' : '<p class="hw_info">\u6e38\u620f\u8f7d\u5165\u4e2d...</p>', '<div class="progress" style="display:none;"><div class="bar">0%</div></div>', "</div>", n ? '<div class="ft" id="hw_ad_' + n + '"></div>' : ""].join(""), D(e), M("body").appendChild(e), n && v(n, "hw_ad_" + n)
        }
        return e
    }

    function f(e) {
        var t, o = m(), r = "none" !== o.style.display;
        "boolean" === k(e) ? e !== r && (t = e ? "block" : "none") : t = r ? "none" : "block", t && (o.style.display = t, n("orientation." + ("none" === t ? "hide" : "show")))
    }

    function m() {
        var e = M(cn);
        if (!e) {
            var t = [cn + " {position:fixed;left:0;top:0;z-index:9999;width:100%;height:100%;box-sizing:border-box;background:rgba(0,0,0,0.8);}", cn + " .inner {width:100%;height:100%;padding-top:200px;pointer-events:none;}", cn + " .tip {position:absolute;left:50%;top:50%;margin-left:-88px;margin-top:-56px;width:200px;z-index:9999;}", cn + " p {color:#4a87ee;font-size:16px;line-height:24px;text-align:center;margin:10px auto;padding:0 10px;}"];
            x(t.join("")), e = et.createElement("div"), e.id = cn.slice(1), e.style.display = "none", e.innerHTML = ['<div class="inner">', '<img src="' + St + '/images/orientation.png" class="tip">', "</div>"].join(" "), D(e), M("body").appendChild(e)
        }
        return e
    }



    function v(t, o, r) {
        t && o && !Ut["ad" + t] && (_(o) && (o = M("#" + o)), et.documentElement.contains(o) && ((e.BAIDU_DUP2 = e.BAIDU_DUP2 || []).push(["fillAsync", t, o]), Ut["ad" + t] = !0, r && n("banner.set")))
    }

    function w() {
        e.BAIDU_DUP2_require || S("http://cpro.baidustatic.com/cpro/ui/cm.js")
    }

    function b(t, n, o, r) {
        var i = new XMLHttpRequest;
        return t === tt && o && (n = P(n, o), o = null), i.open(t, n, !0), Lt && i.setRequestHeader("X-KEY", Lt), (jt || Rt) && i.setRequestHeader("X-TOKEN", Rt || jt), zt && i.setRequestHeader("X-GUID", zt), t === nt && i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), r && (i.onerror = i.onabort = function () {
            y(i), r(null, 500, i)
        }, i.onload = function () {
            y(i);
            var t = i.status;
            if (t >= 200 && 300 > t || 304 === t) {
                var n, o = i.responseText;
                try {
                    n = JSON.parse(o)
                } catch (a) {
                    e[Mt](o)
                }
                if (n && n.url)return void(location.href = n.url);
                n && 1 === n.status ? r(n.data || "", n.status, i) : r(null, n.status, i)
            } else r(null, t, i)
        }), i.send(e.FormData && o instanceof FormData ? o : _(o) ? o : B(o)), i
    }

    function y(e) {
        e.onload = e.onabort = e.onerror = e.ontimeout = null
    }

    function x(e, t) {
        var n;
        t = t || et, n = t.createElement("style"), n.type = "text/css", t.getElementsByTagName("head")[0].appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(t.createTextNode(e))
    }

    function S(e, t) {
        e = e.trim(), t = t || {};
        var n = et.createElement("script");
        n.charset = t.charset || "utf-8", n.defer = "defer", n.async = "async";
        var o = B(t.data);
        e += o ? (e.indexOf("?") < 0 ? "?" : "&") + o : "", n.src = e;
        var r = et.getElementsByTagName("head")[0];
        r ? r.appendChild(n) : (r = et.getElementsByTagName("script")[0], r && r.parentNode.insertBefore(n, r))
    }

    function k(e) {
        return null == e ? String(e) : At[Object.prototype.toString.call(e)] || "object"
    }

    function _(e) {
        return "string" === k(e)
    }

    function E(e) {
        return "function" === k(e)
    }

    function I(e) {
        return "object" === k(e) && Object.getPrototypeOf(e) === Object.prototype
    }

    function C(e, t) {
        Object.keys(e).forEach(function (n) {
            t(n, e[n])
        })
    }

    function T(e, t) {
        return C(t, function (t, n) {
            e[t] = n
        }), e
    }

    function M(e, t) {
        return _(e) ? (t = t || et, t.querySelector(e)) : e
    }

    function A(e, t) {
        return _(e) ? (t = t || et, [].slice.call(t.querySelectorAll(e), 0)) : e
    }

    function O(e) {
        return "string" == typeof e && "" !== e
    }

    function L(e) {
        return O(e)
    }

    function j(t) {
        var n = e.location.search.substr(1).match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)"));
        return n ? decodeURIComponent(n[2]) : null
    }

    function R(e, t) {
        if (O(e)) {
            var n = String(et.cookie).match(new RegExp("(?:^|)" + e + "(?:(?:=([^;]*))|;|$)"));
            if (n)return (n = n[1]) ? t ? decodeURIComponent(n) : n : ""
        }
        return null
    }

    function z(e, t) {
        return t = t || {}, R(L(e) ? e : "", !t.raw)
    }

    function B(e) {
        var t = [];
        return C(e || {}, function (e, n) {
            Array.isArray(n) || (n = [n]), n.forEach(function (n) {
                t.push(e + "=" + encodeURIComponent(n))
            })
        }), t.join("&")
    }

    function P(e, t) {
        _(t) || (t = B(t)), e = e.split("#");
        var n = e[1];
        return e = e[0], t && (e += e.indexOf("?") >= 0 ? "&" : "?", e += t + (n ? "#" + n : "")), e
    }

    function q(e) {
        e && (e.preventDefault(), e.stopPropagation())
    }

    function D(e) {
        e && e.addEventListener(Ot.env.phone ? ot : "click", q, !1)
    }



    function N(e, t, n) {
        var o = null, r = M('meta[name="x-' + e + '"]');
        if (r && (o = (r.getAttribute(t ? "data-" + t : "content") || "").trim()), o && n) {
            var i = {};
            return o.split(",").forEach(function (e) {
                e = e.split("="), i[e[0]] = e[1]
            }), i
        }
        return o
    }

    function H(t) {
        var n = [G + "trackEvent", t].concat(Array.prototype.slice.call(arguments, 1).map(function (e) {
            return t + G + e
        }));
        ["hmt", "czc"].forEach(function (t) {
            var o = e[G + t];
            o && o.push(n)
        })
    }



    for (var Q = ":", F = "/", V = ".", X = "-", G = "_", K = "1", Y = "5", J = [], Z = 97; 122 > Z; Z++)J.push(String.fromCharCode(Z));
    var et = e.document, tt = "GET", nt = "POST", ot = "touchstart", rt = "mousedown", it = location.protocol, at = location.hostname, ct = location.pathname, st = e.navigator.userAgent, ut = J[7] + J[19] + J[19] + J[15] + Q + F + F, lt = V + J[2] + J[14] + J[12], dt = {
        1003: ["ishanku"],
        1004: ["uc", !1, !0, !0],
        1005: ["", !1, !1, !0],
        1006: ["", !1, !1, !0],
        1007: [],
        1008: [],
        1009: [],
        1010: ["", !1, !0, !0],
        1011: "",
        1012: ["chetuobang"],
        1013: ["youxiduo"],
        1014: ["", !1, !0, !0],
        1015: ["", !1, !0, !0],
        1016: ["weibo", !0, !0, !0],
        1019: ["", !1, !1, !0],
        1021: ["meiriq", !1, !0],
        1022: ["8864"],
        1025: ["luoboyou"],
        1026: [],
        1031: ["", !1, !0, !0],
        2003: ["swjoy"],
        3001: ["", !1, !0],
        3004: ["", !1, !1, !0],
        3006: ["", !1, !0],
        3011: ["", !1, !0, !0],
        3014: ["", !1, !1, !1, !0],
        1035: ["", !1, !0]
    }, pt = 0 | j("f"), ht = /(?:51h5|wanh5|h5hero|h5wenhua|h5jiaoyu|h5jiaju|h5gift|h5o2o|linkedin\-professional|udache)\.com$/.test(at), ft = "i1.wanh5.com" === at, mt = ft || /(?:\d+\.){3}\d+/.test(at) || /^dev\./.test(at), gt = mt ? J[3] + J[4] + J[21] + V : "", vt = ut + gt + Y + K + J[7] + Y + lt, wt = vt + F + J[22] + J[23], bt = vt + F + J[0] + J[15] + J[15] + X + J[3] + J[14] + J[22] + J[13] + J[11] + J[14] + J[0] + J[3] + V + J[7] + J[19] + J[12] + J[11], yt = vt + F + J[22] + J[23] + X + J[3] + J[14] + J[22] + J[13] + V + J[7] + J[19] + J[12] + J[11], xt = "http://mp.weixin.qq.com/s?__biz=MzAwODE2MzEwMQ==&mid=202092460&idx=1&sn=5a901ce32da0c3f7bdb8230e5993beb3#rd", St = (ut + gt + J[9] + J[20] + J[12] + J[15] + V + Y + K + J[7] + Y + lt, ut + gt + J[18] + J[19] + J[0] + J[19] + J[8] + J[2] + V + J[22] + J[0] + J[13] + J[7] + Y + lt), kt = ut + "tongji" + V + Y + K + J[7] + Y + lt, _t = ut + gt + J[0] + J[15] + J[8] + V + Y + K + J[7] + Y + lt, Et = ft ? ut + J[0] + J[15] + J[8] + V + Y + K + J[7] + Y + lt : _t, It = F + J[0] + J[15] + J[8] + J[18] + X, Ct = it + "//" + location.host, Tt = Ct + ct.replace(/\/([^\/]+\.\w+)$/, "/").replace(/(\w+)$/, "$1/"), Mt = J[4] + J[21] + J[0] + J[11], At = {};
    "Boolean Number String Function Array Date RegExp Object Error".split(" ").forEach(function (e) {
        At["[object " + e + "]"] = e.toLowerCase()
    });
    var Ot = e.ih5game = {};
    Ot.ver = "1.5.1", Ot.lang = navigator.language.toLowerCase(), Ot.dpr = parseInt(e.devicePixelRatio, 10) || 1, Ot.dprScale = 1, Ot.fontScale = 1, Ot.scale = (screen.width || screen.availWidth) / (e.innerWidth || et.body.clientWidth || et.documentElement.clientWidth), Ot.channel = pt, Ot.server = gt, Ot.preview = ft, Ot.getQuery = j, Ot.getParams = B, Ot.getXMeta = N, Ot.getScript = S, Ot.addStyle = x, Ot.trackEvent = H;
    var Lt, jt, Rt, zt, Bt = {GET: 1, SET: 2}, Pt = {
        init: 1,
        bt: 1,
        vt: 1,
        ui: 1,
        gv: 1,
        jf: 3,
        ph: 1,
        ok: 1,
        data: 3,
        title: 1,
        tc: 2,
        guc: 3,
        gpd: 3,
        dtc: 1,
        grlg: 1
    }, qt = {}, Dt = [], Ut = {
        gameId: null,
        bestScore: 0,
        zhan: parseInt(j("zhan"), 10) || 0,
        ad: {},
        nick: "\u706b\u821e\u73a9\u5bb6",
        options: parseInt(j("hwops"), 10) || 0,
        scale: {},
        share: {
            id: N("share-id") || (/(?:h5gift|h5o2o)\.com$/.test(at) ? "h5weixiao" : "ihuowu"),
            img: N("share-icon"),
            title: N("share-title"),
            titleCustom: N("share-title", "custom"),
            desc: N("share-desc"),
            descCustom: N("share-desc", "custom"),
            link: N("share")
        }
    }, Nt = !1, Ht = !1, Wt = !1, Qt = 3e3, Ft = 1500, Vt = 2e3, Xt = "51h5_", $t = Xt, Gt = "51h5_user", Kt = "wx_user", Yt = {};
    Ot.on = function (e, t) {
        return Yt[e] = Yt[e] || [], Yt[e].push(t), Ot
    }, Ot.once = function (e, t) {
        function n() {
            Ot.off(e, n), t.apply(this, arguments)
        }

        return n.listener = t, Ot.on(e, n), Ot
    }, Ot.off = function (e, t) {
        if (0 === arguments.length)return Yt = {}, Ot;
        var n = Yt[e];
        if (!n)return Ot;
        if (1 === arguments.length)return delete Yt[e], Ot;
        for (var o, r = 0; r < n.length; r++)if (o = n[r], o === t || o.listener === t) {
            n.splice(r, 1);
            break
        }
        return Ot
    }, Ot.env = {}, Ot.is = function (e) {
        return e = e.toLowerCase(), Ot.env.hasOwnProperty(e) && Ot.env[e] ? !0 : !1
    },  Ot.storage = {
        driver: "localStorage"in e ? localStorage : null, get: function (e) {
            return this.driver ? this.driver.getItem($t + e) : null
        }, set: function (e, t, n) {
            !this.driver || !e || n && null !== this.get(e) || this.driver.setItem($t + e, t)
        }, remove: function (e) {
            this.driver && e && null !== this.get(e) && this.driver.removeItem($t + e)
        }, clear: function () {
            if (this.driver)for (var e in this.driver)0 === e.indexOf($t) && this.driver.removeItem(e)
        }
    }, e.addEventListener("storage", function (e) {
        if (Lt) {
            var t = e.key;
            if (t && 0 === t.indexOf($t)) {
                var o = {key: t.slice($t.length), from: e.oldValue, to: e.newValue, time: e.timeStamp, url: e.url};
                null === o.from ? n("storage.add", {
                    key: o.key,
                    value: o.to,
                    time: o.time,
                    url: o.url
                }) : null === o.to ? n("storage.remove", {
                    key: o.key,
                    time: o.time,
                    url: o.url
                }) : n("storage.change", o), n("storage", o)
            }
        }
    }), Ot.is("hoowu") || Ot.is("game") || (Ut.options = 0), Ot.config = function (e, t) {
        if (I(e))for (var n in e)e.hasOwnProperty(n) && Ot.config(n, e[n]); else"nickName" === e && t && (Ut.nick = t);
        return Ot
    }, Ot.getRuntime = function (e) {
        var t = k(Ut[e]);
        return "string" === t || "number" === t || "boolean" === t ? Ut[e] : null
    },  Ot.ssoFinish = function (e) {
        Ot.getUser(function (e) {
            e && e.name && (Ut.nick = e.name)
        }), n("sso", e), n("init")
    }, Ot.ready = function (e) {
        return Wt ? e && e() : Ot.once("ready", e), Ot
    }, /complete|loaded|interactive/.test(et.readyState) && et.body ? Wt = !0 : et.addEventListener("DOMContentLoaded", function () {
        Wt = !0, n("ready")
    }, !1);
    Ot.ready(i);




    var Zt, en = "#hw_share";
    Ot.share = function (e) {
        return Ot.wx.showOptionMenu(), t.style.display = "block", n("share.show"), Zt = setTimeout(function () {
            t.querySelector(".inner").style.pointerEvents = "auto"
        }, 500), Ot
    },
        function (t) {
        t.getShare = function (e) {
            return e ? x[e] : T({}, x)
        }

    }(Ot)



}(this);